import pandas as pd
import numpy as np

def round_all(a,n=2):
    if isinstance(a,dict):
        r={}
        for k,v in a.items():
            rr = round_all(v,n)
            r[k]=rr
        return r
    elif isinstance(a,list):
        r = []
        for i in a:
            rr = round_all(i,n)
            r.append(rr)
        return r
    elif isinstance(a,tuple):
        r=[]
        for i in a:
            rr=round_all(i,n)
            r.append(rr)
        return tuple(r)
    elif isinstance(a,int):
        return round(a, n)
    elif isinstance(a,float):
        return round(a,n)
    elif isinstance(a,pd.DataFrame):
        rst=a.round(2)
        return rst
    elif isinstance(a,pd.Series):
        rst=a.round(2)
        return rst
    elif isinstance(a,np.ndarray):
        rst = a.round(2)
        return rst
    else:
        return a

if __name__=="__main__":
    print(round_all(1,2))
    print(round_all(1.23456, 2))
    print(round_all([1.23456,2.1234567,"a"], 2))
    print(round_all((1.23456,2.1234567,"a"), 2))
    print(round_all({"a":1.23456, "b":2.1234567,"c": "a"}, 2))